<!DOCTYPE html>
<html>
	<!--
    	作者：510669408@qq.com
    	时间：2017-10-16
    	描述：启动主页 加载其他子页面 包括 商品展示也  设置 反馈等
    -->

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title></title>
		<script src="js/mui.min.js"></script>
		<script src="js/jquery-1.11.0.js"></script> 
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/maytao.css" rel="stylesheet" />

	</head>

	<body>
		 
		<!--
  	作者：510669408@qq.com
  	时间：2017-10-11
  	描述：底部導航
  -->
		<nav class="mui-bar mui-bar-tab">

			<!--<a id="tm" class="mui-tab-item mui-active" href="https://tqg.taobao.com/m/jusp/alone/index/mtp.htm?pid=mm_45871999_39404541_147374618">
				 
				<span class="mui-tab-label">淘宝</span>
			</a>-->
			<a id="jd" class="mui-tab-item " style="text-align: center;" href="https://0410c.duomai.com/track.php?k=0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJxYTPklWYmgTN5cjMy0DZp9VZ0l2cmYCdzlGTsxWarNWZzZkMlwGbpt2YlNnRyUSbvNmLkpmLt5yctZkMlYkMlE"> 
				<span class="mui-tab-label">京东</span>
			</a>
			<!--<a id="dd" class="mui-tab-item" href="https://0410c.duomai.com/track.php?k=zUCc0RHa9QnJvFGd5FWb9QWa1VmJ0YTPklWYmgTN5cjMy0DZp9VZ0l2cmAHaw5Cbsl2ajV2cGJTJt92YucmbhR2ZuFGZu0mLoNWdvRnRyUiRyUSQ">
				  
            <span class="mui-tab-label">当当</span>
			</a>-->
			<a id="gm" class="mui-tab-item" href="https://0410c.duomai.com/track.php?k=0ZybhRXeh1WPklWdlZiNzITPklWYmgTN5cjMy0DZp9VZ0l2cmYiJGJTJuNmLt92YuUWbvdmLt5ScGJTJGJTJBNTJzBHd0hWP"> 
				<span class="mui-tab-label">国美</span>
			</a>
           <a id="sn" class="mui-tab-item" href="https://0410c.duomai.com/track.php?k=qZkMlYkMlE0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJ0gTPklWYmgTN5cjMy0DZp9VZ0l2cm0Gdo5CMfBzX0lmbJJXZ0V3bGJTJi9mctxWYwZkMlAXY3ZkMl02bj5yZulmb1NnLt5Sd"> 
				<span class="mui-tab-label">苏宁</span>
			</a>
		</nav>
	</body>
	<script type="text/javascript" charset="utf-8">
		//mui初始化
		mui.init();

	 

		//秒杀弹出
		function Tomiaosha(obj) {
			var msurl = "";
			var title = ""
		/*	if(obj == 1) {
			msurl="https://tqg.taobao.com/m/jusp/alone/index/mtp.htm?pid=mm_45871999_39404541_147374618"
            title="淘宝秒杀"
			} else */
			if(obj == 1) {
				msurl = "https://0410c.duomai.com/track.php?k=0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJxYTPklWYmgTN5cjMy0DZp9VZ0l2cmYCdzlGTsxWarNWZzZkMlwGbpt2YlNnRyUSbvNmLkpmLt5yctZkMlYkMlE"
				title = "京东秒杀"
			} 
			/*else if(obj == 3) {
				title = "当当秒杀"
				msurl = "https://0410c.duomai.com/track.php?k=zUCc0RHa9QnJvFGd5FWb9QWa1VmJ0YTPklWYmgTN5cjMy0DZp9VZ0l2cmAHaw5Cbsl2ajV2cGJTJt92YucmbhR2ZuFGZu0mLoNWdvRnRyUiRyUSQ"
			} */
			else if(obj == 2) {
				title = "国美秒杀"
				msurl = "https://0410c.duomai.com/track.php?k=0ZybhRXeh1WPklWdlZiNzITPklWYmgTN5cjMy0DZp9VZ0l2cmYiJGJTJuNmLt92YuUWbvdmLt5ScGJTJGJTJBNTJzBHd0hWP"
			}
			/*else if(obj==5)
			{
				
			}*/
			else if(obj == 3) {
				title = "苏宁秒杀"
				msurl = "https://0410c.duomai.com/track.php?k=qZkMlYkMlE0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJ0gTPklWYmgTN5cjMy0DZp9VZ0l2cm0Gdo5CMfBzX0lmbJJXZ0V3bGJTJi9mctxWYwZkMlAXY3ZkMl02bj5yZulmb1NnLt5Sd"
			}
			mui.plusReady(function() {
				plus.storage.setItem("msurl", msurl);
				plus.storage.setItem("mstitle", title);
				mui.openWindow({
					url: 'miaosha.html',
					id: 'miaosha'
				})
			});

		}

		$(document).ready(function() {
			navEvent(); 
		}) 

		var subpages = []
		//subpages.push('https://tqg.taobao.com/m/jusp/alone/index/mtp.htm?pid=mm_45871999_39404541_147374618')
		subpages.push('https://0410c.duomai.com/track.php?k=0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJxYTPklWYmgTN5cjMy0DZp9VZ0l2cmYCdzlGTsxWarNWZzZkMlwGbpt2YlNnRyUSbvNmLkpmLt5yctZkMlYkMlE')
		//subpages.push('https://0410c.duomai.com/track.php?k=zUCc0RHa9QnJvFGd5FWb9QWa1VmJ0YTPklWYmgTN5cjMy0DZp9VZ0l2cmAHaw5Cbsl2ajV2cGJTJt92YucmbhR2ZuFGZu0mLoNWdvRnRyUiRyUSQ')
		subpages.push('https://0410c.duomai.com/track.php?k=0ZybhRXeh1WPklWdlZiNzITPklWYmgTN5cjMy0DZp9VZ0l2cmYiJGJTJuNmLt92YuUWbvdmLt5ScGJTJGJTJBNTJzBHd0hWP')
		subpages.push('https://0410c.duomai.com/track.php?k=qZkMlYkMlE0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJ0gTPklWYmgTN5cjMy0DZp9VZ0l2cm0Gdo5CMfBzX0lmbJJXZ0V3bGJTJi9mctxWYwZkMlAXY3ZkMl02bj5yZulmb1NnLt5Sd')
		var subpage_style = {
			top: '0px',
			bottom: '51px'
		};
		var aniShow = {};

		//创建子页面，首个选项卡页面显示，其它均隐藏；
		mui.plusReady(function() {
			var self = plus.webview.currentWebview();
			for(var i = 0; i < subpages.length; i++) {

				var temp = {};
				var sub = plus.webview.create(subpages[i], subpages[i], subpage_style); 
				if(i > 0) {
					sub.hide();
				} else {
					temp[subpages[i]] = "true";
					mui.extend(aniShow, temp);
				}
				self.append(sub);
			//	document.getElementsByClassName("sn-client-t").attr("disabled","none")
			}
		});
		//当前激活选项
		var activeTab = subpages[0];
		//var title = document.getElementById("title");
		//选项卡点击事件
		function tabStartTouch(obj) {

			var targetTab = obj.getAttribute('href');
			if(targetTab == activeTab) {
				return;
			}
			console.log(targetTab)
			//更换标题
			//title.innerHTML = obj.querySelector('.mui-tab-label').innerHTML;
			//显示目标选项卡
			//若为iOS平台或非首次显示，则直接显示
			if(mui.os.ios || aniShow[targetTab]) {
				plus.webview.show(targetTab);
			} else {
				//否则，使用fade-in动画，且保存变量
				var temp = {};
				temp[targetTab] = "true";
				mui.extend(aniShow, temp);
				plus.webview.show(targetTab, "fade-in", 300);
			} 
			//隐藏当前;
			plus.webview.hide(activeTab);
			//更改当前活跃的选项卡
			activeTab = targetTab;
		}
		//自定义事件，模拟点击“首页选项卡”
		document.addEventListener('gohome', function() {
			var defaultTab = document.getElementById("defaultTab");
			//模拟首页点击
			mui.trigger(defaultTab, 'tap');
			//切换选项卡高亮
			var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
			if(defaultTab !== current) {
				current.classList.remove('mui-active');
				defaultTab.classList.add('mui-active');
			}
		});

		//增加 touchstart 事件 阻止click事件
		function navEvent() {
			 /*  var nav = document.getElementById("tm")
			 
				nav.addEventListener("touchstart", function(e) {
					e.preventDefault();
					tabStartTouch(nav)
					 
				});*/
				var settings = document.getElementById("jd")
				settings.addEventListener("touchstart", function(e) {
					e.preventDefault();
					console.log(1)
					tabStartTouch(settings)

				});
				/*var dd = document.getElementById("dd")
				dd.addEventListener("touchstart", function(e) {
					e.preventDefault();
					console.log(2)
					tabStartTouch(dd)

				});*/
				var gm = document.getElementById("gm")
				gm.addEventListener("touchstart", function(e) {
					e.preventDefault();
					tabStartTouch(gm)

				});
				var sn = document.getElementById("sn")
				sn.addEventListener("touchstart", function(e) {
					e.preventDefault();
				
					tabStartTouch(sn)

				});
			 
			 
		}
		 
	</script>

</html>